﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Acms.AcmsControls;

namespace EdgleyDesign10.Web.Templates.Generic
{
    public partial class NavigateUp : TemplatePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (AcmsContext.CurrentPost != null && AcmsContext.CurrentPost.Parent != null)
            {
                AcmsContext.RedirectToPost(AcmsContext.CurrentPost.Parent, this);
            }
            else if (AcmsContext.CurrentPost != null)
            {
                throw new ApplicationException(string.Format("Post {0} has no parent", AcmsContext.CurrentPost.Path));
            }
            else
            {
                throw new ApplicationException("No Current Post");
            }
        }
    }
}
